package com.ruoyi.web.controller.driver;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.framework.web.domain.server.Sys;
import com.ruoyi.system.domain.Purse;
import com.ruoyi.system.service.PurseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/driver")
@CrossOrigin
public class DriverController {

    @Autowired
    private PurseService purseService;

    @GetMapping("/getMoney")
    public Purse getMoney(@RequestParam String driverCode){

        Purse purse= purseService.selectByDriverCode(driverCode);
        return purse;
    }

    @GetMapping("/withdraw")
    public AjaxResult withdraw(@RequestParam("driverCode") String driverCode, @RequestParam("cash")Double cash){
        purseService.updateCash(driverCode,cash);
        return AjaxResult.success();
    }



}



